package jcifs.executors;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import jcifs.Config;

public class DefaultExecutorFactory implements ExecutorFactory {

    @Override
    public ExecutorService make() {
        int maxThreadCount = Config.getInt("executors.threads.count", Runtime.getRuntime().availableProcessors());
        return new ThreadPoolExecutor(0, maxThreadCount,
                                      60L, TimeUnit.SECONDS,
                                      new SynchronousQueue<Runnable>());
    }

}
